package com.itheima.d3_collection_traverse;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.function.Consumer;

/**
 * 目标：完成电影信息的展示。
 * new Movie("《肖生克的救赎》" , 9.7 ,  "罗宾斯")
 * new Movie("《霸王别姬》" , 9.6 ,  "张国荣、张丰毅")
 * new Movie("《阿甘正传》" , 9.5 ,  "汤姆.汉克斯")
 */
public class CollectionTest04 {
    public static void main(String[] args) {
        Collection<Move> moves = new ArrayList<>();
        moves.add(new Move("《肖生克的救赎》", "9.7", "罗宾斯"));
        moves.add(new Move("《霸王别姬》", "9.6 ", "张国荣、张丰毅"));
        moves.add(new Move("《阿甘正传》", "9.5", "汤姆.汉克斯"));
//        System.out.println(moves);

        moves.forEach(move -> System.out.println("电影名称：" + move.getName() + " 评分：" + move.getScore() + " 主演：" + move.getActor()));
        System.out.println("-------------------------------------------");
        for (Move move : moves) {
            System.out.println("电影名称：" + move.getName() + " 评分：" + move.getScore() + " 主演：" + move.getActor());
        }
        System.out.println("-------------------------------------------");
        Iterator<Move> it = moves.iterator();
        while (it.hasNext()) {
            Move move = it.next();
            System.out.println("电影名称：" + move.getName() + " 评分：" + move.getScore() + " 主演：" + move.getActor());
        }
    }
}
